USE [EstudiosComerciales]
GO
 -- creating the store procedure
IF EXISTS (SELECT name 
	   FROM   sysobjects 
	   WHERE  name = 'WASP_D0002_TRUNCATE_TABLE_CSOPF000'
	   AND 	  type = 'P')
    DROP PROCEDURE [dbo].[WASP_D0002_TRUNCATE_TABLE_CSOPF000]
GO
CREATE PROCEDURE [dbo].[WASP_D0002_TRUNCATE_TABLE_CSOPF000]
AS

BEGIN
if exists (select * from dbo.sysobjects where id = object_id(N'[SQL].[CSOPF000]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [SQL].[CSOPF000]
END

CREATE TABLE [SQL].[CSOPF000] (
	[CRAGENCIA] [int] NULL ,
	[CRCREDITO] [int] NULL ,
	[CRMARCA] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[CRRUTDEUDO] [decimal](8, 0) NULL ,
	[CRTIPCLIE] [numeric](2, 0) NULL ,
	[CRDVEDEUDO] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[CRRUTCOD1] [decimal](8, 0) NULL ,
	[CRDVECOD1] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[CRRUTCOD2] [decimal](8, 0) NULL ,
	[CRDVECOD2] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[CRRUTEMPRE] [int] NULL ,
	[CRDVEEMPRE] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[CRCLASE] [decimal](2, 0) NULL ,
	[CRCUOTAS] [decimal](3, 0) NULL ,
	[CRFECAPROB] [decimal](8, 0) NULL ,
	[CRVALCUOTA] [decimal](9, 2) NULL ,
	[CRDIASPRIM] [int] NULL ,
	[CRMONTO] [decimal](11, 2) NULL ,
	[CRORIGEN] [decimal](11, 2) NULL ,
	[CRSEGURO] [decimal](9, 2) NULL ,
	[CRTASA] [decimal](8, 4) NULL ,
	[CRESPECIAL] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[CRMODIFICA] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[STSMODREGC] [decimal](1, 0) NULL ,
	[FMODIFREGC] [decimal](8, 0) NULL ,
	[USRMODREGC] [char] (10) COLLATE Modern_Spanish_CI_AS NULL ,
	[CRINDICA] [char] (2) COLLATE Modern_Spanish_CI_AS NULL ,
	[CRSERIE] [decimal](4, 0) NULL ,
	[CRNOTARIO] [decimal](6, 0) NULL ,
	[CRIMPUESTO] [decimal](6, 0) NULL ,
	[CRCOMISION] [decimal](10, 0) NULL ,
	[CRFECUPAGO] [decimal](8, 0) NULL ,
	[USRMODAPRO] [char] (10) COLLATE Modern_Spanish_CI_AS NULL ,
	[CRFECRELIQ] [decimal](8, 0) NULL ,
	[USRMODRELI] [char] (10) COLLATE Modern_Spanish_CI_AS NULL ,
	[CRFECPRVEN] [decimal](8, 0) NULL ,
	[CRGASTOPER] [decimal](6, 0) NULL ,
	[CRMONABONA] [decimal](11, 2) NULL ,
	[CRESTADO] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[CRSEGDESGR] [decimal](7, 0) NULL ,
	[CRSTSVGTE] [decimal](1, 0) NULL ,
	[CRSTSMORA] [decimal](1, 0) NULL ,
	[CRAGECOLOC] [int] NULL ,
	[FILLER] [char] (40) COLLATE Modern_Spanish_CI_AS NULL ,
	[ENDEUD_MAXIMO] decimal (17,2)Null,
	DISPONIBLE [decimal](17, 2) NULL ,
	[COD_ANALISTA] [char] (30) COLLATE Modern_Spanish_CI_AS NULL ,
	[ANALISTA] [char] (30) COLLATE Modern_Spanish_CI_AS NULL ,
	[ESTADOTRAB] [int] NULL ,
	[CRMONTO_LIQ] [numeric](11, 0) NULL ,
	[CANCELADO] [varchar] (2) COLLATE Modern_Spanish_CI_AS NULL ,
	[Solicitante][int] null,
	Tip_Cancela varchar(6),
	[CRSEGCesantia] [numeric](9, 0) NULL ,
             [CTABANTOTAL] [numeric](9)null,
	[Oficina] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Vendedor] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , 
             [crsegsalud] [numeric](9, 0) NULL 
) ON [PRIMARY]